import { toBeSubmittedColumns } from './toBeSubmitted.config.js'
import search from './../search/search.js';
import { fetchList } from '@/api/shop/info.js'
export default {
    name: "toBeSubmitted",
    mixins: [search],
    data() {
        return {
            toBeSubmittedColumns,
            loading: false,
            loadData: [{
                id: 1,
                fs:'http://img3.imgtn.bdimg.com/it/u=1940916231,627575868&fm=26&gp=0.jpg'
            }],
            pagination: {
                total: 0,
                current: 1,
                pageSize: 10,
            },
            showSizeChanger: true,
            showTotal: total => `共有${total}条`,
            selectedRowKeys: [],  //选中的数组
            selectedRows: [],
            number: 0,
            btn: [
                // {
                //     title:"提交审核",
                //     isShow:true
                // },
                // {
                //     title:"删除",
                //     isShow:true
                // },
                // {
                //     title:"导出",
                //     isShow:true
                // },
            ]
        }
    },
    filters: {
        glstatus: data => {
            switch (data) {
                case "01":
                    return "营业中";
                case "02":
                    return "停业";
                default:
            }
        },
        glbusinessType: data => {
            switch (data) {
                case "01":
                    return "全部业务";
                case "02":
                    return "商超";
                case "03":
                    return "洗衣";
                case "04":
                    return "家政";
                case "05":
                    return "咖啡";
                default:
            }
        },
        glshopType: data => {
            switch (data) {
                case "01":
                    return "平台";
                case "02":
                    return "分公司";
                case "03":
                    return "代理商";
                default:
            }
        },
    },
    methods: {
        getList(searchForm, page) {
            if (searchForm) {
                console.log(searchForm)
            }
            if (page) {
                this.pagination.current = page
            }
            fetchList(Object.assign({status:'01'}, searchForm ? searchForm : {}, this.pagination)).then(val => {
                let data = val.data
                this.pagination.total = data.total
                this.pagination.current = data.current
                this.pagination.pageSize = data.size
                this.loadData = data.records
                this.$emit("trigger")
            })
        },
        handleTableChange(pagination) {
            this.pagination.current = pagination.current
            this.pagination.pageSize = pagination.pageSize
            this.getList()
        },
        onSelectChange(selectedRowKeys, selectedRows) {
            this.selectedRowKeys = selectedRowKeys
            this.selectedRows = selectedRows;
            this.number = this.selectedRows.length
        },
        // 清空选中项
        clearSelection() {
            this.selectedRowKeys = []
            this.number = 0
        },
        handler(index) {
            if (index == 0) {
                this.submitShenHe()
            } else if (index == 1) {
                this.delete()
            } else if (index == 2) {
                this.export()
            }
        },
        // 提交审核
        submitShenHe() {

        },
        // 删除
        delete() {

        },
        // 导出
        export() {

        }
    }

} 